from scipy.stats import ttest_ind
from scipy.stats import levene
import numpy as np
a = [0.8221, 0.8149, 0.7993, 0.8097, 0.8089]
b = [0.8306, 0.8349, 0.8317, 0.8283, 0.8528]
a, b = np.array(a), np.array(b)
print(f'{a.mean().round(4):.4f}±{a.std().round(4):.4f}', '\n', f'{b.mean().round(4):.4f}±{b.std().round(4):.4f}', sep='')
l_p = levene(a, b).pvalue
print('levene p-value:', l_p)
print(ttest_ind(a, b, equal_var=l_p>0.05, axis=0))
"""
cls_cta_cons_val_accuracy_2  =  [0.9860, 0.9874, 0.9883, 0.9878, 0.9870] 0.9873±0.0008 pvalue=0.24659802059751607
cls_cta_cons_val_recallneg_2 =  [0.9938, 0.9946, 0.9937, 0.9936, 0.9899] 0.9931±0.0016 pvalue=0.443543507586288
cls_cta_cons_val_recallad_2  =  [0.9895, 0.9870, 0.9877, 0.9905, 0.9915] 0.9892±0.0017 pvalue=0.28016243153166187
cls_cta_cons_val_recallimh_2 =  [0.8974, 0.9206, 0.9398, 0.9224, 0.9398] 0.9240±0.0156 pvalue=0.2803903723524882

cls_cta_cons_test_accuracy_2  = [0.9714, 0.9722, 0.9713, 0.9697, 0.9738] 0.9717±0.0013 pvalue=0.11516527931336124
cls_cta_cons_test_recallneg_2 = [0.9870, 0.9852, 0.9849, 0.9842, 0.9785] 0.9840±0.0029 pvalue=0.9362789407941718
cls_cta_cons_test_recallad_2  = [0.9581, 0.9596, 0.9539, 0.9596, 0.9742] 0.9611±0.0069 pvalue=0.3201746485982401
cls_cta_cons_test_recallimh_2 = [0.9123, 0.9288, 0.9411, 0.9075, 0.9404] 0.9260±0.0140 pvalue=0.2776377685645888
"""
"""
cls_cta_ori_val_accuracy   = [0.9868, 0.9872, 0.9871, 0.9865, 0.9862] 0.9868±0.0004
cls_cta_ori_val_recallneg  = [0.9940, 0.9950, 0.9938, 0.9935, 0.9929] 0.9938±0.0007
cls_cta_ori_val_recallad   = [0.9876, 0.9901, 0.9872, 0.9883, 0.9872] 0.9881±0.0011
cls_cta_ori_val_recallimh  = [0.9157, 0.9005, 0.9228, 0.9125, 0.9183] 0.9140±0.0075

cls_cta_ori_test_accuracy  = [0.9716, 0.9658, 0.9645, 0.9717, 0.9702] 0.9688±0.0030
cls_cta_ori_test_recallneg = [0.9847, 0.9866, 0.9789, 0.9848, 0.9840] 0.9838±0.0026
cls_cta_ori_test_recallad  = [0.9680, 0.9437, 0.9475, 0.9608, 0.9558] 0.9552±0.0088
cls_cta_ori_test_recallimh = [0.8952, 0.9027, 0.9274, 0.9212, 0.9274] 0.9148±0.0133
"""


"""
cls_ct_cons_val_accuracy_2  =  [0.9032, 0.9037, 0.9063, 0.9031, 0.9014] 0.9035±0.0016 pvalue=0.0382659911701174
cls_ct_cons_val_recallneg_2 =  [0.9278, 0.9299, 0.9295, 0.9156, 0.9270] 0.9260±0.0053 pvalue=0.0011918105489553844
cls_ct_cons_val_recallad_2  =  [0.9268, 0.9197, 0.9332, 0.9458, 0.9206] 0.9292±0.0096 pvalue=0.014784943466361342
cls_ct_cons_val_recallimh_2 =  [0.6510, 0.6701, 0.6510, 0.6580, 0.6588] 0.6578±0.0070 pvalue=5.188652323864617e-07

cls_ct_cons_test_accuracy_2  = [0.8844, 0.8951, 0.8803, 0.8811, 0.8821] 0.8846±0.0054 pvalue=0.5733036370437119
cls_ct_cons_test_recallneg_2 = [0.9105, 0.9203, 0.9017, 0.8892, 0.9088] 0.9061±0.0103 pvalue=0.041833291948057356
cls_ct_cons_test_recallad_2  = [0.9165, 0.9128, 0.9103, 0.9374, 0.9036] 0.9161±0.0114 pvalue=0.7289770310501414
cls_ct_cons_test_recallimh_2 = [0.6275, 0.6919, 0.6569, 0.6457, 0.6569] 0.6558±0.0210 pvalue=0.010704617288334918
"""

"""
cls_ct_ori_val_accuracy  = [0.9007, 0.9011, 0.9018, 0.9024, 0.8978] 0.9008±0.0016
cls_ct_ori_val_recallneg = [0.9401, 0.9415, 0.9410, 0.9465, 0.9365] 0.9411±0.0032
cls_ct_ori_val_recallad  = [0.9142, 0.9160, 0.9181, 0.9071, 0.9103] 0.9131±0.0040
cls_ct_ori_val_recallimh = [0.5892, 0.5770, 0.5814, 0.5936, 0.5944] 0.5871±0.0068

cls_ct_ori_test_accuracy  = [0.8940, 0.8885, 0.8805, 0.8826, 0.8880] 0.8867±0.0048
cls_ct_ori_test_recallneg = [0.9225, 0.9228, 0.9115, 0.9240, 0.9181] 0.9198±0.0046
cls_ct_ori_test_recallad  = [0.9236, 0.9132, 0.9128, 0.9040, 0.9153] 0.9138±0.0063
cls_ct_ori_test_recallimh = [0.6317, 0.6092, 0.5952, 0.5742, 0.6246] 0.6070±0.0207
"""

"""
cls_ct_cons_val_recallimh_1  = [0.6580, 0.6466, 0.6493, 0.6554, 0.6780] 0.6575±0.0111
cls_ct_cons_val_recallimh_2  = [0.6510, 0.6701, 0.6510, 0.6580, 0.6588] 0.6578±0.0070 *
cls_ct_cons_val_recallimh_3  = [0.6571, 0.6466, 0.6353, 0.6667, 0.6510] 0.6513±0.0105
cls_ct_cons_val_recallimh_4  = [0.6797, 0.6876, 0.6406, 0.6701, 0.6745] 0.6705±0.0160

cls_ct_cons_test_recallimh_1 = [0.6471, 0.6218, 0.6527, 0.6681, 0.6597] 0.6499±0.0157
cls_ct_cons_test_recallimh_2 = [0.6275, 0.6919, 0.6569, 0.6457, 0.6569] 0.6558±0.0210 *
cls_ct_cons_test_recallimh_3 = [0.6190, 0.6218, 0.6527, 0.6611, 0.6261] 0.6361±0.0173
cls_ct_cons_test_recallimh_4 = [0.6443, 0.6863, 0.6246, 0.6303, 0.6527] 0.6476±0.0217
"""

"""
cls_ct_ori_test_precisionad  = [0.8221, 0.8149, 0.7993, 0.8097, 0.8089] 0.8110±0.0075 pvalue=0.002760724613946029
cls_ct_ori_test_precisionimh = [0.8306, 0.8349, 0.8317, 0.8283, 0.8528] 0.8357±0.0088 pvalue=0.002760724613946029
"""


#yolo_ct_val_p = [0.965, 0.969, 0.976, 0.963, 0.967]
#yolo_ct_val_r = [0.97, 0.972, 0.979, 0.971, 0.974]
#yolo_ct_val_ap5 = [0.977, 0.988, 0.99, 0.985, 0.985]
#yolo_ct_val_ap595 = [0.626, 0.637, 0.624, 0.627, 0.625]

#yolo_ct_test_p = [0.987, 0.976, 0.979, 0.976, 0.981]
#yolo_ct_test_r = [0.973, 0.982, 0.983, 0.972, 0.984]
#yolo_ct_test_ap5 = [0.99, 0.991, 0.993, 0.992, 0.991]
#yolo_ct_test_ap595 = [0.804, 0.781, 0.776, 0.759, 0.792]

#yolo_cta_val_p = [0.963, 0.96, 0.955, 0.966, 0.971]
#yolo_cta_val_r = [0.955, 0.958, 0.968, 0.952, 0.952]
#yolo_cta_val_ap5 = [0.974, 0.975, 0.981, 0.977, 0.983]
#yolo_cta_val_ap595 = [0.718, 0.716, 0.722, 0.721, 0.719]

#yolo_cta_test_p = [0.99, 0.99, 0.99, 0.987, 0.987]
#yolo_cta_test_r = [0.986, 0.986, 0.988, 0.987, 0.991]
#yolo_cta_test_ap5 = [0.994, 0.993, 0.994, 0.993, 0.993]
#yolo_cta_test_ap595 = [0.74, 0.747, 0.742, 0.737, 0.728]



"""
cls_ct_cons_val_recallimh_1  = [0.6580, 0.6466, 0.6493, 0.6554, 0.6780] 0.6575±0.0111
cls_ct_cons_val_recallimh_2  = [0.6510, 0.6701, 0.6510, 0.6580, 0.6588] 0.6578±0.0070 *
cls_ct_cons_val_recallimh_3  = [0.6571, 0.6466, 0.6353, 0.6667, 0.6510] 0.6513±0.0105
cls_ct_cons_val_recallimh_4  = [0.6797, 0.6876, 0.6353, 0.6701, 0.6745] 0.6694±0.0180

cls_ct_cons_test_recallimh_1 = [0.6471, 0.6218, 0.6527, 0.6681, 0.6597] 0.6499±0.0157
cls_ct_cons_test_recallimh_2 = [0.6275, 0.6919, 0.6569, 0.6457, 0.6569] 0.6558±0.0210 *
cls_ct_cons_test_recallimh_3 = [0.6190, 0.6218, 0.6527, 0.6611, 0.6261] 0.6361±0.0173
cls_ct_cons_test_recallimh_4 = [0.6443, 0.6863, 0.5966, 0.6303, 0.6527] 0.6420±0.0293
"""
